def is_valid(db,provider_id):
	cur=db.cursor()
	cur.execute("""select count(id) from link_providers where id=%s""",(provider_id,))
	cnt=cur.fetchone()[0]
	cur.close()
	if cnt==1:
		return True
	else:
		return False

def get_id(db,provider_name):
	cur=db.cursor()
	cur.execute("""select id from link_providers where name=%s""", (provider_name,))
	id=cur.fetchone()
	cur.close()
	if not id is None : 
		return id[0]
	else:
		return -1
